from app import db

class LifestyleAdjustments(db.Model):
    __tablename__ = 'lifestyle_adjustments'

    adjustment_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.String(255), db.ForeignKey('user_info.user_id'), nullable=False)
    nutrient_id = db.Column(db.Integer, db.ForeignKey('nutrient_reference_intakes.id'), nullable=False)
    adjustment_factor = db.Column(db.Float, nullable=False)  # 调整因子
    date = db.Column(db.Date, nullable=False)

    # user = db.relationship('UserInfo', back_populates='lifestyle_adjustments')
    nutrient = db.relationship('NutrientReferenceIntakes', back_populates='lifestyle_adjustments')
